package com.example.serviceribbon.controller;

import com.example.serviceribbon.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloController {

    @Autowired
    HelloService helloService;

    @RequestMapping(value = "/hi")
    @ResponseBody
    public String hiForrRequestParam(@RequestParam String name){
        return helloService.hiServiceForRequestParam(name);
    }

    @RequestMapping(value = "/hi/{name}")
    @ResponseBody
    public String hiForPathVariable(@PathVariable String name){
        return helloService.hiServiceForPathVariable(name);
    }

    @RequestMapping(value = "/me")
    @ResponseBody
    public String me(){
        return "i am ribbon";
    }
}
